/*
 * Copyright (c) Jack魏 2023 - 2024, All Rights Reserved.
 */

package cn.jackwei.yiyi.controller.view.sys;

import cn.hutool.core.util.StrUtil;
import cn.jackwei.yiyi.pojo.bean.SysUser;
import cn.jackwei.yiyi.service.sys.SysUserService;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * 系统用户页面
 *
 * @author Jack魏
 * @since 2023/11/22 20:25
 */
@Controller
@RequestMapping("/sys")
public class SysUserView {
    @Resource
    private SysUserService sysUserService;

    /**
     * 用户资料维护
     */
    @GetMapping("userInfo")
    public String userInfo(String userId, Model model) {
        if (StrUtil.isNotBlank(userId)) {
            SysUser user = sysUserService.getById(userId);
            model.addAttribute("editUser", user);
        }
        return "sys/userInfo";
    }

    /**
     * 用户管理
     *
     * @return 用户管理页面
     */
    @GetMapping("userView")
    public String userView() {
        return "sys/userView";
    }
}
